import {appName} from '@/router/router';
const permission = {
  install (Vue, options) {
    Vue.directive('permission', {
      bind (el, binding, vnode) {
        let _vue = vnode.componentInstance;
        let controlName = binding.value;
        let pageName = _vue.$router.currentRoute.name;
        let ac = _vue.$auth.user().access;
        if (!_.some(ac, {appName: appName, controlName: controlName, pageName: pageName, permit:true})) {
          el.style.display = 'none';
        }
      }
    });
  }
};

export default permission;